<%@page contentType="text/html;charset=utf-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:useBean id="info" class="top.zerozoo.learn.grade.vo.QueryScoreInfo" scope="request"/>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>成绩查询</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="css/global.css">
    <script src="js/jquery-2.1.0.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <style type="text/css">
        td, th {
            text-align: center;
        }
    </style>
</head>
<body>
<div class="container">
    <h3 style="text-align: center">成绩查询</h3>
    <div class="action-bar clearfix mb10 mt20">
        <div class="fl">
            <form class="form-inline" id="form-search" action="${pageContext.request.contextPath}/queryScore.do"
                  method="get">
                <div class="form-group">
                    <label for="studentID">学号</label>
                    <input type="text" class="form-control" id="studentID" name="studentID"
                           value="${info.condition.studentID}">
                </div>
                <button type="submit" class="btn btn-default">查询</button>
            </form>
        </div>
    </div>
    <!-- 出错显示的信息框 -->
    <c:if test="${not empty requestScope.error_msg}">
        <div class="alert alert-warning alert-dismissible" role="alert">
            <button type="button" class="close" data-dismiss="alert" >
                <span>&times;</span></button>
            <strong>${requestScope.error_msg}</strong>
        </div>
    </c:if>
    <form id="form-remove" action="${pageContext.request.contextPath}/studentRemove.do" method="post">
        <table class="table table-bordered table-hover">
            <tr class="success">
                <th>课程</th>
                <th>分数</th>
            </tr>
            <c:forEach items="${info.pageInfo.list}" var="item" varStatus="status">
                <tr>
                    <td>${item.name}</td>
                    <td>${item.score}</td>
                        <%--                    <td>--%>
                        <%--                        <a class="btn btn-default btn-sm" href="studentDetail.do?studentID=${item.id}">详情</a>--%>
                        <%--                        <a class="btn btn-default btn-sm" href="javascript:removeUser(${item.id})">删除</a>--%>
                        <%--                    </td>--%>
                </tr>
            </c:forEach>
        </table>
    </form>

    <nav aria-label="Search results pages">
        <ul class="pagination">
            <c:if test="${info.pageInfo.currentPage == 1}">
                <li class="disabled">
                    <a href="#" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>
            </c:if>
            <c:if test="${info.pageInfo.currentPage != 1}">
                <li>
                    <a href="${pageContext.request.contextPath}/queryScore.do?currentPage=${info.pageInfo.currentPage-1}&rows=20&studentID=${info.condition.studentID}"
                       aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>
            </c:if>
            <c:forEach begin="1" end="${info.pageInfo.totalPage}" step="1" var="i">
                <c:if test="${info.pageInfo.currentPage == i}">
                    <li class="active"><a href="#">${i}</a></li>
                </c:if>
                <c:if test="${info.pageInfo.currentPage != i}">
                    <li>
                        <a href="${pageContext.request.contextPath}/queryScore.do?currentPage=${i}&rows=20&studentID=${info.condition.studentID}">${i}</a>
                    </li>
                </c:if>

            </c:forEach>
            <c:if test="${info.pageInfo.currentPage == info.pageInfo.totalPage}">
                <li class="disabled">
                    <a href="#" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
            </c:if>
            <c:if test="${info.pageInfo.currentPage != info.pageInfo.totalPage}">
                <li>
                    <a href="${pageContext.request.contextPath}/queryScore.do?currentPage=${info.pageInfo.currentPage+1}&rows=20&studentID=${info.condition.studentID}"
                       aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
            </c:if>
        </ul>
    </nav>
    <p class="f24 ml10 mb30">共${info.pageInfo.totalCount}条记录，${info.pageInfo.totalPage}页</p>
</div>
</body>
</html>
